/*******************************************************************************
 * -------
 *   Copyright 2011 @ Fluid India Consultancy
 *   All Rights Reserved
 * -------
 ******************************************************************************/
package org.fluidindia.security.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.fluidindia.security.domain.User;
import org.springframework.jdbc.core.RowMapper;


/**
 * Provides mapping for records in <code>ad_users</code> table to {@link User}
 * 
 * @author Kapil Viren Ahuja
 *
 */
public class UserMapper implements RowMapper<User>
{
    
    /**
     * <p>
     * Maps a single row from {@link ResultSet} to {@link User}
     * </p>
     * 
     * Also, @see RowMapper#mapRow(ResultSet, int)
     * 
     */
    public User mapRow(ResultSet rs, int rowNum) throws SQLException
    {
        User result = new User();
        
        result.setId(rs.getLong("id"));
        result.setUsername(rs.getString("username"));
        return result;
    }
}
